package com.itheima.streamDemo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.stream.Stream;

public class StreamDemo6 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        Collections.addAll(list1, "张无忌","张无忌","张无忌", "张强", "张三丰", "张翠山", "张良", "王二麻子", "谢广坤");

        ArrayList<String> list2 = new ArrayList<>();
        Collections.addAll(list2, "周芷若", "赵敏");


        // distinct            元素去重，依赖(hashCode和equals方法)
        list1.stream().distinct().forEach(s -> System.out.println(s));


        Stream.concat(list1.stream(),list2.stream()).forEach(s -> System.out.println(s));

    }
}
